<template>
    <el-container>
        <el-header class="header-tabs">
            <el-tabs type="card" v-model="groupId" @tab-change="tabChange">
				<el-tab-pane label="全部" name="0"></el-tab-pane>
				<el-tab-pane label="打版中" name="1"></el-tab-pane>
				<el-tab-pane label="审版中" name="3"></el-tab-pane>
				<el-tab-pane label="修版中" name="4"></el-tab-pane>
				<el-tab-pane label="已通过" name="5"></el-tab-pane>
				<el-tab-pane label="待下单" name="6"></el-tab-pane>
				<el-tab-pane label="已下单" name="7"></el-tab-pane>
				<el-tab-pane label="已取消" name="9"></el-tab-pane>
			</el-tabs>
        </el-header>
        <el-header>
            <div class="left-panel">
                <div class="right-panel-search">
                    <div class="search-input">工厂</div>
                    <el-select v-model="search.supplier_id"  filterable placeholder="请选择工厂" clearable>
                        <el-option v-for="item in gongList" :key="item.apply_id" :label="item.apply_name" :value="item.apply_id"/>
                    </el-select>
                    <div class="search-input">客户</div>
                    <el-select v-model="search.custom_id"  filterable placeholder="请选择客户" clearable>
                        <el-option v-for="item in keHuList" :key="item.custom_id" :label="item.apply_name" :value="item.custom_id"/>
                    </el-select>
                    <div class="search-input">版单编号</div>
                    <el-input v-model="search.order_no" placeholder="请输入版单编号" clearable @change="handleKeyDown"/>
                    <el-input v-model="search.keyword" placeholder="请输入工厂货号/SKC/码数" clearable @change="handleKeyDown"/>
                    <el-button type="primary" icon="el-icon-search" @click="upsearch">搜索</el-button>
                </div>
            </div>
        </el-header>
        <el-header v-if="groupId == 0">
            <div>
                <el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'edition.add'">新增版单</el-button>
                <el-button type="primary" @click="printAll" :disabled="selection.length == 0" v-auth="'editionall.printall'">批量打印版单</el-button>
                <!-- <el-button type="primary" @click="generate" :disabled="selection.length == 0" v-auth="'editionall.create'">生成结算单</el-button> -->
            </div>
        </el-header>
        <!-- 全部 -->
        <el-main class="nopadding" v-if="groupId == 0">
            <scTable ref="table" :apiObj="apiObj" @selection-change="selectionChange" stripe remoteSort remoteFilter border :params="query">
                <el-table-column type="selection" width="50" align="center"></el-table-column>
                <el-table-column fixed label="版单编号" prop="order_no" align="center" width="150"></el-table-column>
                <el-table-column fixed label="商品信息" prop="goods" align="center" width="300">
                    <template #default="scope">
                        <div class="shopInfo">
                            <el-image class="img" :src="scope.row.images[0]" :preview-src-list="scope.row.images" :initial-index="0" fit="cover" preview-teleported="true" hide-on-click-modal />
                            <div class="right">
                                <div>工厂货号：{{scope.row.goods.factory_art_no}}</div>
                                <div>样衣尺码：{{scope.row.goods.size}}</div>
                                <div>SKC：{{scope.row.goods.skc}}</div>
                                <div>客户：{{scope.row.goods.custom_name}}</div>
                                <div v-if="scope.row.goods">商品品牌：{{scope.row.goods.brand_name}}</div>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="工厂" prop="apply_name" align="center" width="80"></el-table-column>
                <el-table-column label="打板交期" prop="deliver_date" align="center" width="120">
                    <template #default="scope">
                        <div>{{scope.row.deliver_date}}</div>
                        <div class="day">
                            <!-- <div style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div> -->
                            <div v-if="scope.row.has_day>0" style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div v-else style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="打板要求" prop="ask" align="center" width="150">
                    <template #default="scope">
                        <el-popover
                            placement="top-start"
                            :width="200"
                            trigger="hover"
                            :content="scope.row.ask"
                        >
                        <template #reference>
                            <el-button style="padding: 5px 0;" text class="m-2">{{scope.row.ask.substring(0, 10)}}···</el-button>
                        </template>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column label="毛料" prop="marterial" align="center" width="150">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material_name}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="色号" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.color_number}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="颜色" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.colour}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="版次" prop="num" align="center" width="110"></el-table-column>
                <el-table-column label="工厂报价" prop="factory_quote" align="center" width="110" v-auth="'factory.price'"></el-table-column>
                <el-table-column label="下单核价" prop="order_pricing" align="center" width="110"></el-table-column>
                <el-table-column label="版单状态" prop="status" align="center" width="100">
                    <template #default="scope">
                        <el-tag v-if="scope.row.status==1" type="primary">打版中</el-tag>
                        <el-tag v-if="scope.row.status==2" type="warning">待签收</el-tag>
                        <el-tag v-if="scope.row.status==3" type="info">审版中</el-tag>
                        <el-tag v-if="scope.row.status==4" type="info">修版中</el-tag>
                        <el-tag v-if="scope.row.status==5" type="success">已完成</el-tag>
                        <el-tag v-if="scope.row.status==6" type="success">已维护</el-tag>
                        <el-tag v-if="scope.row.status==7" type="success">已下单</el-tag>
                        <el-tag v-if="scope.row.status==9" type="danger">已取消</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="操作" fixed="right" align="center" width="120">
                    <template #default="scope">
                        <el-button-group style="display:flex;flex-direction:column">
                            <div v-if="editionall">
                                <sc-status-indicator type="danger" v-if="scope.row.is_print == 0"></sc-status-indicator>
                                <el-button text type="primary" size="small" @click="print(scope.row, scope.$index)" v-auth="'editionall.print'">打印版单</el-button> 
                            </div>
                            <el-button text type="primary" size="small" @click="complete(scope.row, scope.$index)" v-auth="'editionall.finish'">完成打板</el-button>
                            <el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)" v-auth="'editionall.show'">查看</el-button>
                            <el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index)" v-auth="'editionall.edit'">修改</el-button>
                            <el-popconfirm title="确定取消吗？" @confirm="table_cancel(scope.row, scope.$index)">
                                <template #reference>
                                    <el-button text type="danger" size="small" v-auth="'editionall.cancel'">取消</el-button>
                                </template>
                            </el-popconfirm>
                            <!-- <el-popconfirm title="确定删除吗？" @confirm="table_del(scope.row, scope.$index)" v-auth="'edition.delete'">
                                <template #reference>
                                    <el-button text type="danger" size="small">删除</el-button>
                                </template>
                            </el-popconfirm> -->
                        </el-button-group>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
        <!-- 打版中 -->
        <el-main class="nopadding" v-if="groupId == 1">
            <scTable ref="table" :apiObj="apiObj" stripe remoteSort remoteFilter border :params="query">
                <el-table-column type="selection" width="50"></el-table-column>
                <el-table-column fixed label="版单编号" prop="order_no" align="center" width="150"></el-table-column>
                <el-table-column fixed label="商品信息" prop="goods" align="center" width="300">
                    <template #default="scope">
                        <div class="shopInfo">
                            <el-image class="img" :src="scope.row.images[0]" :preview-src-list="scope.row.images" :initial-index="0" fit="cover" preview-teleported="true" hide-on-click-modal />
                            <div class="right">
                                <div>工厂货号：{{scope.row.goods.factory_art_no}}</div>
                                <div>样衣尺码：{{scope.row.goods.size}}</div>
                                <div>SKC：{{scope.row.goods.skc}}</div>
                                <div>客户：{{scope.row.goods.custom_name}}</div>
                                <div v-if="scope.row.goods">商品品牌：{{scope.row.goods.brand_name}}</div>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="工厂" prop="apply_name" align="center" width="80"></el-table-column>
                <el-table-column label="打板交期" prop="deliver_date" align="center" width="120">
                    <template #default="scope">
                        <div>{{scope.row.deliver_date}}</div>
                        <div class="day">
                            <!-- <div style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div> -->
                            <div v-if="scope.row.has_day>0" style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div v-else style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="打板要求" prop="ask" align="center" width="150">
                    <template #default="scope">
                        <el-popover
                            placement="top-start"
                            :width="200"
                            trigger="hover"
                            :content="scope.row.ask"
                        >
                        <template #reference>
                            <el-button style="padding: 5px 0;" text class="m-2">{{scope.row.ask.substring(0, 10)}}···</el-button>
                        </template>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column label="毛料" prop="marterial" align="center" width="150">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material_name}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="色号" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.color_number}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="颜色" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.colour}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="版次" prop="num" align="center" width="110"></el-table-column>
                <el-table-column label="工厂报价" prop="factory_quote" align="center" width="110"></el-table-column>
                <el-table-column label="下单核价" prop="order_pricing" align="center" width="110"></el-table-column>
                <el-table-column label="版单状态" prop="status" align="center" width="100">
                    <template #default="scope">
                        <el-tag v-if="scope.row.status==1" type="primary">打版中</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="操作" fixed="right" align="center" width="120">
                    <template #default="scope">
                        <el-button-group style="display:flex;flex-direction:column">
                            <div v-if="printing">
                                <sc-status-indicator type="danger" v-if="scope.row.is_print == 0"></sc-status-indicator>
                                <el-button text type="primary" size="small" @click="print(scope.row, scope.$index)" v-auth="'printing.print'">打印版单</el-button>
                            </div>
                            <el-button text type="primary" size="small" @click="complete(scope.row, scope.$index)" v-auth="'printing.finish'">完成打版</el-button>
                            <el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)" v-auth="'printing.show'">查看</el-button>
                            <el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index)" v-auth="'printing.edit'">修改</el-button>
                            <el-popconfirm title="确定取消吗？" @confirm="table_cancel(scope.row, scope.$index)">
                                <template #reference>
                                    <el-button text type="danger" size="small" v-auth="'printing.cancel'">取消</el-button>
                                </template>
                            </el-popconfirm>
                        </el-button-group>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
        <!-- 审版中 -->
        <el-main class="nopadding" v-if="groupId == 3">
            <scTable ref="table" :apiObj="apiObj" stripe remoteSort remoteFilter border :params="query">
                <el-table-column type="selection" width="50"></el-table-column>
                <el-table-column fixed label="版单编号" prop="order_no" align="center" width="150"></el-table-column>
                <el-table-column fixed label="商品信息" prop="goods" align="center" width="300">
                    <template #default="scope">
                        <div class="shopInfo">
                            <el-image class="img" :src="scope.row.images[0]" :preview-src-list="scope.row.images" :initial-index="0" fit="cover" preview-teleported="true" hide-on-click-modal />
                            <div class="right">
                                <div>工厂货号：{{scope.row.goods.factory_art_no}}</div>
                                <div>样衣尺码：{{scope.row.goods.size}}</div>
                                <div>SKC：{{scope.row.goods.skc}}</div>
                                <div>客户：{{scope.row.goods.custom_name}}</div>
                                <div v-if="scope.row.goods">商品品牌：{{scope.row.goods.brand_name}}</div>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="工厂" prop="apply_name" align="center" width="80"></el-table-column>
                <el-table-column label="打板交期" prop="deliver_date" align="center" width="120">
                    <template #default="scope">
                        <div>{{scope.row.deliver_date}}</div>
                        <div class="day">
                            <!-- <div style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div> -->
                            <div v-if="scope.row.has_day>0" style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div v-else style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="打板要求" prop="ask" align="center" width="150">
                    <template #default="scope">
                        <el-popover
                            placement="top-start"
                            :width="200"
                            trigger="hover"
                            :content="scope.row.ask"
                        >
                        <template #reference>
                            <el-button style="padding: 5px 0;" text class="m-2">{{scope.row.ask.substring(0, 10)}}···</el-button>
                        </template>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column label="毛料" prop="marterial" align="center" width="150">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material_name}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="色号" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.color_number}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="颜色" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.colour}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="版次" prop="num" align="center" width="110"></el-table-column>
                <el-table-column label="工厂报价" prop="factory_quote" align="center" width="110"></el-table-column>
                <el-table-column label="下单核价" prop="order_pricing" align="center" width="110"></el-table-column>
                <el-table-column label="寄送时间" prop="sign_time" align="center" width="150"></el-table-column>
                <el-table-column label="版单状态" prop="status" align="center" width="100">
                    <template #default="scope">
                        <el-tag v-if="scope.row.status==1" type="primary">打版中</el-tag>
                        <el-tag v-if="scope.row.status==2" type="warning">待签收</el-tag>
                        <el-tag v-if="scope.row.status==3" type="info">审版中</el-tag>
                        <el-tag v-if="scope.row.status==4" type="info">修版中</el-tag>
                        <el-tag v-if="scope.row.status==5" type="success">已完成</el-tag>
                        <el-tag v-if="scope.row.status==6" type="success">已维护</el-tag>
                        <el-tag v-if="scope.row.status==7" type="success">已下单</el-tag>
                        <el-tag v-if="scope.row.status==9" type="danger">已取消</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="修改评语" prop="comment" align="center" width="130">
                    <template #default="scope">
                        <el-button text type="primary" size="small" v-if="scope.row.comment" @click="showCom(scope.row)">查看评语</el-button>
                    </template>
                </el-table-column>
                <el-table-column label="操作" fixed="right" align="center" width="100">
                    <template #default="scope">
                        <el-button-group style="display:flex;flex-direction:column">
                            <el-button text type="primary" size="small" @click="checkPrice(scope.row, scope.$index)" v-auth="'examine.price'">修改价格</el-button>
                            <el-button text type="primary" size="small" @click="checkComment(scope.row, scope.$index)" v-auth="'examine.comment'">修改评语</el-button>
                            <el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index)" v-auth="'examine.edit'">编辑</el-button>
                            <el-popconfirm title="确定通过吗？" @confirm="table_pass(scope.row, scope.$index)">
                                <template #reference>
                                    <el-button text type="primary" size="small" v-auth="'examine.pass'">通过</el-button>
                                </template>
                            </el-popconfirm>
                            <el-popconfirm title="确定拒绝吗？" @confirm="table_refuse(scope.row, scope.$index)">
                                <template #reference>
                                    <el-button text type="danger" size="small" v-auth="'examine.refuse'">拒绝</el-button>
                                </template>
                            </el-popconfirm>
                            <el-popconfirm title="确定取消吗？" @confirm="table_cancel(scope.row, scope.$index)">
                                <template #reference>
                                    <el-button text type="danger" size="small" v-auth="'examine.cancel'">取消</el-button>
                                </template>
                            </el-popconfirm>
                            <el-popconfirm title="确定删除吗？" @confirm="table_del(scope.row, scope.$index)">
                                <template #reference>
                                    <el-button text type="danger" size="small" v-auth="'examine.delete'">删除</el-button>
                                </template>
                            </el-popconfirm>
                        </el-button-group>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
        <!-- 修版中 -->
        <el-main class="nopadding" v-if="groupId == 4">
            <scTable ref="table" :apiObj="apiObj" stripe remoteSort remoteFilter border :params="query">
                <el-table-column type="selection" width="50"></el-table-column>
                <el-table-column fixed label="版单编号" prop="order_no" align="center" width="150"></el-table-column>
                <el-table-column fixed label="商品信息" prop="goods" align="center" width="300">
                    <template #default="scope">
                        <div class="shopInfo">
                            <el-image class="img" :src="scope.row.images[0]" :preview-src-list="scope.row.images" :initial-index="0" fit="cover" preview-teleported="true" hide-on-click-modal />
                            <div class="right">
                                <div>工厂货号：{{scope.row.goods.factory_art_no}}</div>
                                <div>样衣尺码：{{scope.row.goods.size}}</div>
                                <div>SKC：{{scope.row.goods.skc}}</div>
                                <div>客户：{{scope.row.goods.custom_name}}</div>
                                <div v-if="scope.row.goods">商品品牌：{{scope.row.goods.brand_name}}</div>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="工厂" prop="apply_name" align="center" width="80"></el-table-column>
                <el-table-column label="打板交期" prop="deliver_date" align="center" width="120">
                    <template #default="scope">
                        <div>{{scope.row.deliver_date}}</div>
                        <div class="day">
                            <!-- <div style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div> -->
                            <div v-if="scope.row.has_day>0" style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div v-else style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="打板要求" prop="ask" align="center" width="150">
                    <template #default="scope">
                        <el-popover
                            placement="top-start"
                            :width="200"
                            trigger="hover"
                            :content="scope.row.ask"
                        >
                        <template #reference>
                            <el-button style="padding: 5px 0;" text class="m-2">{{scope.row.ask.substring(0, 10)}}···</el-button>
                        </template>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column label="毛料" prop="marterial" align="center" width="150">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material_name}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="色号" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.color_number}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="颜色" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.colour}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="版次" prop="num" align="center" width="110"></el-table-column>
                <el-table-column label="工厂报价" prop="factory_quote" align="center" width="110"></el-table-column>
                <el-table-column label="下单核价" prop="order_pricing" align="center" width="110"></el-table-column>
                <el-table-column label="修版开始时间" prop="end_time" align="center" width="150"></el-table-column>
                <el-table-column label="版单状态" prop="status" align="center" width="100">
                    <template #default="scope">
                        <el-tag v-if="scope.row.status==1" type="primary">打版中</el-tag>
                        <el-tag v-if="scope.row.status==2" type="warning">待签收</el-tag>
                        <el-tag v-if="scope.row.status==3" type="info">审版中</el-tag>
                        <el-tag v-if="scope.row.status==4" type="info">修版中</el-tag>
                        <el-tag v-if="scope.row.status==5" type="success">已完成</el-tag>
                        <el-tag v-if="scope.row.status==6" type="success">已维护</el-tag>
                        <el-tag v-if="scope.row.status==7" type="success">已下单</el-tag>
                        <el-tag v-if="scope.row.status==9" type="danger">已取消</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="操作" fixed="right" align="center" width="100">
                    <template #default="scope">
                        <el-button-group style="display:flex;flex-direction:column">
                            <el-button text type="primary" size="small" @click="complete(scope.row, scope.$index)" v-auth="'retouch.complete'">完成打版</el-button>
                            <el-popconfirm title="确定取消吗？" @confirm="table_cancel(scope.row, scope.$index)" v-auth="'retouch.cancel'">
                                <template #reference>
                                    <el-button text type="danger" size="small">取消</el-button>
                                </template>
                            </el-popconfirm>
                            <el-popconfirm title="确定删除吗？" @confirm="table_del(scope.row, scope.$index)">
                                <template #reference>
                                    <el-button text type="danger" size="small" v-auth="'retouch.delete'">删除</el-button>
                                </template>
                            </el-popconfirm>
                        </el-button-group>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
        <!-- 已通过 -->
        <el-main class="nopadding" v-if="groupId == 5">
            <scTable ref="table" :apiObj="apiObj" stripe remoteSort remoteFilter border :params="query">
                <el-table-column type="selection" width="50"></el-table-column>
                <el-table-column fixed label="版单编号" prop="order_no" align="center" width="150"></el-table-column>
                <el-table-column fixed label="商品信息" prop="goods" align="center" width="300">
                    <template #default="scope">
                        <div class="shopInfo">
                            <el-image class="img" :src="scope.row.images[0]" :preview-src-list="scope.row.images" :initial-index="0" fit="cover" preview-teleported="true" hide-on-click-modal />
                            <div class="right">
                                <div>工厂货号：{{scope.row.goods.factory_art_no}}</div>
                                <div>样衣尺码：{{scope.row.goods.size}}</div>
                                <div>SKC：{{scope.row.goods.skc}}</div>
                                <div>客户：{{scope.row.goods.custom_name}}</div>
                                <div v-if="scope.row.goods">商品品牌：{{scope.row.goods.brand_name}}</div>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="工厂" prop="apply_name" align="center" width="80"></el-table-column>
                <el-table-column label="打板交期" prop="deliver_date" align="center" width="120">
                    <template #default="scope">
                        <div>{{scope.row.deliver_date}}</div>
                        <div class="day">
                            <!-- <div style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div> -->
                            <div v-if="scope.row.has_day>0" style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div v-else style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="打板要求" prop="ask" align="center" width="150">
                    <template #default="scope">
                        <el-popover
                            placement="top-start"
                            :width="200"
                            trigger="hover"
                            :content="scope.row.ask"
                        >
                        <template #reference>
                            <el-button style="padding: 5px 0;" text class="m-2">{{scope.row.ask.substring(0, 10)}}···</el-button>
                        </template>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column label="毛料" prop="marterial" align="center" width="150">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material_name}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="色号" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.color_number}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="颜色" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.colour}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="版次" prop="num" align="center" width="110"></el-table-column>
                <el-table-column label="工厂报价" prop="factory_quote" align="center" width="110"></el-table-column>
                <el-table-column label="下单核价" prop="order_pricing" align="center" width="110"></el-table-column>
                <el-table-column label="通过时间" prop="end_time" align="center" width="150"></el-table-column>
                <el-table-column label="版单状态" prop="status" align="center" width="100">
                    <template #default="scope">
                        <el-tag v-if="scope.row.status==1" type="primary">打版中</el-tag>
                        <el-tag v-if="scope.row.status==2" type="warning">待签收</el-tag>
                        <el-tag v-if="scope.row.status==3" type="info">审版中</el-tag>
                        <el-tag v-if="scope.row.status==4" type="info">修版中</el-tag>
                        <el-tag v-if="scope.row.status==5" type="success">已通过</el-tag>
                        <el-tag v-if="scope.row.status==6" type="success">已维护</el-tag>
                        <el-tag v-if="scope.row.status==7" type="success">已下单</el-tag>
                        <el-tag v-if="scope.row.status==9" type="danger">已取消</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="修改评语" prop="comment" align="center" width="130">
                    <template #default="scope">
                        <el-popover
                            placement="top-start"
                            :width="200"
                            trigger="hover"
                            :content="scope.row.comment"
                        >
                        <template #reference>
                            <el-button style="padding: 5px 0;" text class="m-2">{{scope.row.comment.substring(0, 15)}}</el-button>
                        </template>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column label="操作" fixed="right" align="center" width="100">
                    <template #default="scope">
                        <el-button-group style="display:flex;flex-direction:column">
                            <el-button text type="primary" size="small" @click="showPrice(scope.row, scope.$index)" v-auth="'examine.price'">价格查看</el-button>
                            <el-button text type="primary" size="small" @click="openData(scope.row, scope.$index)" v-auth="'pass.main'">维护资料</el-button>
                            <el-popconfirm title="确定取消吗？" @confirm="table_cancel(scope.row, scope.$index)">
                                <template #reference>
                                    <el-button text type="danger" size="small" v-auth="'pass.cancel'">取消</el-button>
                                </template>
                            </el-popconfirm>
                        </el-button-group>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
        <!-- 待下单 -->
        <el-main class="nopadding" v-if="groupId == 6">
            <scTable ref="table" :apiObj="apiObj" stripe remoteSort remoteFilter border :params="query">
                <el-table-column type="selection" width="50"></el-table-column>
                <el-table-column fixed label="版单编号" prop="order_no" align="center" width="150"></el-table-column>
                <el-table-column fixed label="商品信息" prop="goods" align="center" width="300">
                    <template #default="scope">
                        <div class="shopInfo">
                            <el-image class="img" :src="scope.row.images[0]" :preview-src-list="scope.row.images" :initial-index="0" fit="cover" preview-teleported="true" hide-on-click-modal />
                            <div class="right">
                                <div>工厂货号：{{scope.row.goods.factory_art_no}}</div>
                                <div>样衣尺码：{{scope.row.goods.size}}</div>
                                <div>SKC：{{scope.row.goods.skc}}</div>
                                <div>客户：{{scope.row.goods.custom_name}}</div>
                                <div v-if="scope.row.goods">商品品牌：{{scope.row.goods.brand_name}}</div>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="工厂" prop="apply_name" align="center" width="80"></el-table-column>
                <el-table-column label="打板交期" prop="deliver_date" align="center" width="120">
                    <template #default="scope">
                        <div>{{scope.row.deliver_date}}</div>
                        <div class="day">
                            <!-- <div style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div> -->
                            <div v-if="scope.row.has_day>0" style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div v-else style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="打板要求" prop="ask" align="center" width="150">
                    <template #default="scope">
                        <el-popover
                            placement="top-start"
                            :width="200"
                            trigger="hover"
                            :content="scope.row.ask"
                        >
                        <template #reference>
                            <el-button style="padding: 5px 0;" text class="m-2">{{scope.row.ask.substring(0, 10)}}···</el-button>
                        </template>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column label="毛料" prop="marterial" align="center" width="150">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material_name}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="色号" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.color_number}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="颜色" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.colour}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="版次" prop="num" align="center" width="110"></el-table-column>
                <el-table-column label="工厂报价" prop="factory_quote" align="center" width="110"></el-table-column>
                <el-table-column label="下单核价" prop="order_pricing" align="center" width="110"></el-table-column>
                <el-table-column label="版单状态" prop="status" align="center" width="100">
                    <template #default="scope">
                        <el-tag v-if="scope.row.status==1" type="primary">打版中</el-tag>
                        <el-tag v-if="scope.row.status==2" type="warning">待签收</el-tag>
                        <el-tag v-if="scope.row.status==3" type="info">审版中</el-tag>
                        <el-tag v-if="scope.row.status==4" type="info">修版中</el-tag>
                        <el-tag v-if="scope.row.status==5" type="success">已完成</el-tag>
                        <el-tag v-if="scope.row.status==6" type="success">已维护</el-tag>
                        <el-tag v-if="scope.row.status==7" type="success">已下单</el-tag>
                        <el-tag v-if="scope.row.status==9" type="danger">已取消</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="操作" fixed="right" align="center" width="100">
                    <template #default="scope">
                        <el-button-group style="display:flex;flex-direction:column">
                            <el-button text type="primary" size="small" @click="showPrice(scope.row, scope.$index)" v-auth="'examine.price'">价格查看</el-button>
                            <el-button text type="primary" size="small" @click="createOrder(scope.row, scope.$index)" v-auth="'wait.create'">下单</el-button>
                            <el-popconfirm title="确定取消吗？" @confirm="table_cancel(scope.row, scope.$index)" v-auth="'wait.cancel'">
                                <template #reference>
                                    <el-button text type="danger" size="small">取消</el-button>
                                </template>
                            </el-popconfirm>
                            <el-popconfirm title="确定删除吗？" @confirm="table_del(scope.row, scope.$index)">
                                <template #reference>
                                    <el-button text type="danger" size="small" v-auth="'wait.delete'">删除</el-button>
                                </template>
                            </el-popconfirm>
                        </el-button-group>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
        <!-- 已下单 -->
        <el-main class="nopadding" v-if="groupId == 7">
            <scTable ref="table" :apiObj="apiObj" stripe remoteSort remoteFilter border :params="query">
                <el-table-column type="selection" width="50"></el-table-column>
                <el-table-column fixed label="版单编号" prop="order_no" align="center" width="150"></el-table-column>
                <el-table-column fixed label="商品信息" prop="goods" align="center" width="300">
                    <template #default="scope">
                        <div class="shopInfo">
                            <el-image class="img" :src="scope.row.images[0]" :preview-src-list="scope.row.images" :initial-index="0" fit="cover" preview-teleported="true" hide-on-click-modal />
                            <div class="right">
                                <div>工厂货号：{{scope.row.goods.factory_art_no}}</div>
                                <div>样衣尺码：{{scope.row.goods.size}}</div>
                                <div>SKC：{{scope.row.goods.skc}}</div>
                                <div>客户：{{scope.row.goods.custom_name}}</div>
                                <div v-if="scope.row.goods">商品品牌：{{scope.row.goods.brand_name}}</div>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="工厂" prop="apply_name" align="center" width="80"></el-table-column>
                <el-table-column label="打板交期" prop="deliver_date" align="center" width="120">
                    <template #default="scope">
                        <div>{{scope.row.deliver_date}}</div>
                        <div class="day">
                            <!-- <div style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div> -->
                            <div v-if="scope.row.has_day>0" style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div v-else style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="打板要求" prop="ask" align="center" width="150">
                    <template #default="scope">
                        <el-popover
                            placement="top-start"
                            :width="200"
                            trigger="hover"
                            :content="scope.row.ask"
                        >
                        <template #reference>
                            <el-button style="padding: 5px 0;" text class="m-2">{{scope.row.ask.substring(0, 10)}}···</el-button>
                        </template>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column label="毛料" prop="marterial" align="center" width="150">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material_name}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="色号" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.color_number}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="颜色" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.colour}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="版次" prop="num" align="center" width="110"></el-table-column>
                <el-table-column label="工厂报价" prop="factory_quote" align="center" width="110"></el-table-column>
                <el-table-column label="下单核价" prop="order_pricing" align="center" width="110"></el-table-column>
                <el-table-column label="下单时间" prop="order_time" align="center" width="150"></el-table-column>
                <el-table-column label="版单状态" prop="status" align="center" width="100">
                    <template #default="scope">
                        <el-tag v-if="scope.row.status==1" type="primary">打版中</el-tag>
                        <el-tag v-if="scope.row.status==2" type="warning">待签收</el-tag>
                        <el-tag v-if="scope.row.status==3" type="info">审版中</el-tag>
                        <el-tag v-if="scope.row.status==4" type="info">修版中</el-tag>
                        <el-tag v-if="scope.row.status==5" type="success">已完成</el-tag>
                        <el-tag v-if="scope.row.status==6" type="success">已维护</el-tag>
                        <el-tag v-if="scope.row.status==7" type="success">已下单</el-tag>
                        <el-tag v-if="scope.row.status==9" type="danger">已取消</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="操作" fixed="right" align="center" width="100">
                    <template #default="scope">
                        <el-button-group style="display:flex;flex-direction:column">
                            <el-button text type="primary" size="small" @click="showPrice(scope.row, scope.$index)" v-auth="'examine.price'">价格查看</el-button>
                            <el-popconfirm title="确定取消吗？" @confirm="table_cancel(scope.row, scope.$index)">
                                <template #reference>
                                    <el-button text type="danger" size="small" v-auth="'ordered.cancel'">取消</el-button>
                                </template>
                            </el-popconfirm>
                        </el-button-group>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
        <!-- 已取消 -->
        <el-main class="nopadding" v-if="groupId == 9">
            <scTable ref="table" :apiObj="apiObj" stripe remoteSort remoteFilter border :params="query">
                <el-table-column type="selection" width="50"></el-table-column>
                <el-table-column fixed label="版单编号" prop="order_no" align="center" width="150"></el-table-column>
                <el-table-column fixed label="商品信息" prop="goods" align="center" width="300">
                    <template #default="scope">
                        <div class="shopInfo">
                            <el-image class="img" :src="scope.row.images[0]" :preview-src-list="scope.row.images" :initial-index="0" fit="cover" preview-teleported="true" hide-on-click-modal />
                            <div class="right">
                                <div>工厂货号：{{scope.row.goods.factory_art_no}}</div>
                                <div>样衣尺码：{{scope.row.goods.size}}</div>
                                <div>SKC：{{scope.row.goods.skc}}</div>
                                <div>客户：{{scope.row.goods.custom_name}}</div>
                                <div v-if="scope.row.goods">商品品牌：{{scope.row.goods.brand_name}}</div>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="工厂" prop="apply_name" align="center" width="80"></el-table-column>
                <el-table-column label="打板交期" prop="deliver_date" align="center" width="120">
                    <template #default="scope">
                        <div>{{scope.row.deliver_date}}</div>
                        <div class="day">
                            <!-- <div style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div> -->
                            <div v-if="scope.row.has_day>0" style="color:#67c23a">剩{{scope.row.has_day}}天</div>
                            <div v-else style="color:red;margin-left:10px">超{{scope.row.extra_day}}天</div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="打板要求" prop="ask" align="center" width="150">
                    <template #default="scope">
                        <el-popover placement="top-start" :width="200" trigger="hover" :content="scope.row.ask">
                            <template #reference>
                                <el-button style="padding: 5px 0;" text class="m-2">{{scope.row.ask.substring(0, 10)}}···</el-button>
                            </template>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column label="毛料" prop="marterial" align="center" width="150">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material_name}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="色号" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.color_number}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="颜色" prop="marterial" align="center" width="100">
                    <template #default="scope">
                        <div style="height:100px;overflow:auto;display: flex;flex-direction: column;justify-content: center;">
                            <div v-for="(item,index) in scope.row.marterial" :key="index">
                                {{item.material.colour}}
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="版次" prop="num" align="center" width="110"></el-table-column>
                <el-table-column label="工厂报价" prop="factory_quote" align="center" width="110"></el-table-column>
                <el-table-column label="下单核价" prop="order_pricing" align="center" width="110"></el-table-column>
                <el-table-column label="取消时间" prop="cancel_time" align="center" width="150"></el-table-column>
                <el-table-column label="版单状态" prop="status" align="center" width="100">
                    <template #default="scope">
                        <el-tag v-if="scope.row.status==1" type="primary">打版中</el-tag>
                        <el-tag v-if="scope.row.status==2" type="warning">待签收</el-tag>
                        <el-tag v-if="scope.row.status==3" type="info">审版中</el-tag>
                        <el-tag v-if="scope.row.status==4" type="info">修版中</el-tag>
                        <el-tag v-if="scope.row.status==5" type="success">已完成</el-tag>
                        <el-tag v-if="scope.row.status==6" type="success">已维护</el-tag>
                        <el-tag v-if="scope.row.status==7" type="success">已下单</el-tag>
                        <el-tag v-if="scope.row.status==9" type="danger">已取消</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="操作" fixed="right" align="center" width="100">
                    <template #default="scope">
                        <el-button-group>
                            <el-popconfirm title="确定删除吗？" @confirm="table_del(scope.row, scope.$index)">
                                <template #reference>
                                    <el-button text type="danger" size="small" v-auth="'canceled.delete'">删除</el-button>
                                </template>
                            </el-popconfirm>
                        </el-button-group>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
    </el-container>
    <save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSuccess" @closed="dialog.save = false" draggable></save-dialog><!-- 新增版单 -->
    <complete-save v-if="dialog.com" ref="comDialog" @success="handleSuccess" @closed="dialog.com = false" draggable></complete-save><!-- 全部,打版中的完成打版 -->
    <print ref="pitDialog"></print><!-- 打印-->
    <price-change v-if="dialog.price" ref="priceDialog" @success="handleSuccess" @closed="dialog.price = false" draggable></price-change><!-- 修改价格 -->
    <comment v-if="dialog.book" ref="bookDialog" @success="handleSuccess" @closed="dialog.book = false" draggable></comment><!-- 修改评语 -->
    <main-info v-if="dialog.main" ref="mainDialog" @success="handleSuccess" @closed="dialog.main = false" draggable></main-info><!-- 维护资料 -->
    <create-order v-if="dialog.order" ref="orderDialog" @success="handleSuccess" @closed="dialog.order = false" draggable></create-order><!-- 下单 -->
    <print-edlition v-if="dialog.print" ref="printDialog" @success="handleSuccess" @closed="dialog.print = false"></print-edlition>
</template>

<script>
import CompleteSave from './completeSave.vue';
import Print from './print';
import saveDialog from './save'
import PriceChange from './priceChange';//价格
import Comment from './comment';//评语
import MainInfo from './mainInfo.vue';//维护资料
import CreateOrder from './createOrder.vue';//下单
import PrintEdlition from './printEdlition.vue';
export default {
	name: 'user',
	components: {
		saveDialog,Print,CompleteSave,PriceChange,Comment,MainInfo,CreateOrder,PrintEdlition
	},
	data() {
		return {
			dialog: {
				save: false,
				main: false,
                pit:false,
                com:false,
                test:false,
                price:false,
                book:false,
                order:false,
                print:false
			},
			apiObj: this.$API.develop.edition.lists,
            query:{
                status:""
            },
			selection: [],
			search: {
				supplier_id: null,
				custom_id: null,
                order_no:null,
                design_num:null,
                keyword:null,
			},
			gongList: [],//供应商
			keHuList: [],//客户
            tabId:"",
            groupId: "0",
            editionall:this.$TOOL.data.get("PERMISSIONS").includes('editionall.print'),
            printing:this.$TOOL.data.get("PERMISSIONS").includes('printing.print'),
		}
	},
	mounted() {
        this.getGong()
        this.getKehu()
	},
	methods: {
        checkAuth(perm){
            console.log(this.$TOOL.data,perm,'this.$TOOL.data')
            let permissions =  this.$TOOL.data.get("PERMISSIONS");
            console.log(permissions,perm,'perm')
		    if (!permissions.some((v) => v === perm)){
                console.log(1)
                return false
            }else{
                console.log(2)
                return true
            }
        },
        //添加打板
		add() {
			this.dialog.save = true
			this.$nextTick(() => {
				this.$refs.saveDialog.open('add')
			})
		},
        // 打印
        // async print(row){
        //     var reqData = { id: row.id };
        //     var res = await this.$API.print.editionPrint.get(reqData);
		// 	if (res.code == 1) {
		// 		this.$refs.pitDialog.init(res.data);
		// 	} else {
		// 		this.$alert(res.message, "提示", { type: "error" });
		// 	}
        // },
        async print(row){
            var reqData = { ids: row.id };
            var res = await this.$API.print.editionPrintAll.get(reqData);
			if (res.code == 1) {
                this.dialog.print = true;
                setTimeout(()=>{
                    this.$refs.printDialog.open("edit").setData(res.data.template_data);
                },500)
			} else {
				this.$alert(res.message, "提示", { type: "error" });
			}
        },
        // 批量打印
        async printAll(){
            let ids = []
            this.selection.map(item=>{
                ids.push(item.id)
            })
            var reqData = { ids:ids };
            var res = await this.$API.print.editionPrintAll.get(reqData);
            if (res.code == 1) {
                // this.$refs.pitDialog.init(res.data);
                this.dialog.print = true;
                setTimeout(()=>{
                    this.$refs.printDialog.open("add").setData(res.data.template_data);
                },500)
            } else {
                this.$alert(res.message, "提示", { type: "error" });
            }
        },
        // 全部,打版中,修版中完成打版
        complete(row) {
			this.dialog.com = true;
			this.$nextTick(() => {
				this.$refs.comDialog.open("over").setData(row);
			});
		},
		//全部,打版中,审版中编辑
		table_edit(row) {
			this.dialog.save = true;
			this.$nextTick(() => {
				this.$refs.saveDialog.open("edit").setData(row);
			});
		},
		//全部,打版中,查看
		table_show(row) {
			this.dialog.save = true;
			this.$nextTick(() => {
				this.$refs.saveDialog.open("show").setData(row);
			});
		},
         // 审版修改价格
        checkPrice(row){
            this.dialog.price = true;
			this.$nextTick(() => {
				this.$refs.priceDialog.open("over").setData(row);
			});
        },
        showPrice(row){
            this.dialog.price = true;
			this.$nextTick(() => {
				this.$refs.priceDialog.open("show").setData(row);
			});
        },
        // 审版修改评语
        checkComment(row){
            this.dialog.book = true;
			this.$nextTick(() => {
				this.$refs.bookDialog.open("over").setData(row);
			});
        },
        // 审版查看评语
        showCom(row){
            this.dialog.book = true;
			this.$nextTick(() => {
				this.$refs.bookDialog.open("show").setData(row);
			});
        },
         // 审版通过
        async table_pass(row) {
			var reqData = { id: row.id,status:5 };
			var res = await this.$API.develop.edition.examine.post(reqData);
			if (res.code == 1) {
				//这里选择刷新整个表格 OR 插入/编辑现有表格数据
                this.$refs.table.refresh();
				this.$message.success("操作成功");
			} else {
				this.$alert(res.message, "提示", { type: "error" });
			}
		},
        // 审版拒绝
        async table_refuse(row) {
			var reqData = { id: row.id,status:4 };
			var res = await this.$API.develop.edition.examine.post(reqData);
			if (res.code == 1) {
				//这里选择刷新整个表格 OR 插入/编辑现有表格数据
                this.$refs.table.refresh();
				this.$message.success("已拒绝");
			} else {
				this.$alert(res.message, "提示", { type: "error" });
			}
		},
        // 下单
        createOrder(row){
            this.dialog.order = true
			this.$nextTick(() => {
				this.$refs.orderDialog.open('open').setData(row)
			})
        },
		//删除
		async table_del(row, index) {
			var reqData = { id: row.id };
			var res = await this.$API.develop.edition.delete.post(reqData);
			if (res.code == 1) {
				//这里选择刷新整个表格 OR 插入/编辑现有表格数据
				this.$refs.table.tableData.splice(index, 1);
				this.$message.success("删除成功");
			} else {
				this.$alert(res.message, "提示", { type: "error" });
			}
		},
        //除了已取消的所有取消
        async table_cancel(row) {
			var reqData = { id: row.id };
			var res = await this.$API.develop.edition.cancel.post(reqData);
			if (res.code == 1) {
				//这里选择刷新整个表格 OR 插入/编辑现有表格数据
                this.$refs.table.refresh();
				this.$message.success("取消成功");
			} else {
				this.$alert(res.message, "提示", { type: "error" });
			}
		},
        // 维护资料
        openData(row) {
            this.dialog.main = true
			this.$nextTick(() => {
				this.$refs.mainDialog.open('open').setData(row)
			})
		},
        selectionChange(selection){
            this.selection = selection;
        },
		//搜索
		upsearch() {
			this.$refs.table.upData(this.search)
		},
        //本地更新数据
		handleSuccess(data, mode) {
            console.log('mode :>> ', mode);
			if (mode == "add") {
				this.$refs.table.refresh();
			} else if (mode == "edit") {
				this.$refs.table.refresh();
			} else if (mode == "open") {
				this.$refs.table.refresh();
			} else if (mode == "over") {
				this.$refs.table.refresh();
			}
		},
        // 获取工厂
        async getGong(){
            var res = await this.$API.all.Apply.get({type:1});
            this.gongList = res.data;
        },
        // 获取客户
        async getKehu(){
            var res = await this.$API.all.customer.get();
            this.keHuList = res.data;
        },
        // tab切换
        tabChange(e){
            this.groupId = e
            this.query.status = e
            this.search.supplier_id = null
            this.search.custom_id = null
            this.search.order_no = null
            this.search.keyword = null
            console.log('this.search :>> ', this.search);
            this.upsearch()
        },
        handleKeyDown() {
            this.upsearch()
        },
		// 生成结算单
		// async generate() {
		// 	var delete_ids = [];
		// 	this.selection.forEach((item) => {
		// 		delete_ids.push(item.id);
		// 	});
		// 	this.$confirm(
		// 		`确定生成选中的 ${this.selection.length} 项吗？`,
		// 		"提示",
		// 		{
		// 			type: "warning",
		// 		}
		// 	)
		// 		.then(() => {
		// 			this.allCreate(delete_ids);
		// 		})
		// 		.catch(() => { });
		// },
        //  async allCreate(delete_ids) {
		// 	var reqData = { template_ids: delete_ids };
		// 	var res = await this.$API.develop.edition.createBill.post(reqData);
		// 	if (res.code == 1) {
		// 		this.$refs.table.refresh();
		// 		this.$message.success("操作成功");
		// 	} else {
		// 		this.$alert(res.message, "提示", { type: "error" });
		// 	}
		// },
	}
}
</script>

<style lang="scss">
.search-input {
	width: auto;
	font-size: 14px;
}
</style>
